/*
 * include/asm/serial.h
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  (C) Copyright 2004, Li Chunqiang (chunqiang_li@c-sky.com)
 *  (C) Copyright 2009, Hu Junshan (junshan_hu@c-sky.com)
 *  (C) Copyright 2009, C-SKY Microsystems Co., Ltd. (www.c-sky.com)
 *
 */

/*
 * This assumes you have a 1.8432 MHz clock for your UART.
 *
 * It'd be nice if someone built a serial card with a 24.576 MHz
 * clock, since the 16550A is capable of handling a top speed of 1.5
 * megabits/second; but this requires the faster clock.
 */

#ifndef _CKCORE_SERIAL_H
#define _CKCORE_SERIAL_H

#define BASE_BAUD ( 1843200 / 16 )

#ifdef CONFIG_SERIAL_CDB4

#define CONFIG_SERIAL_SHARE_IRQ

#define CDB4_COM_BASE		((u8 *)0x40000000)
#define CDB4_COM_IRQ		67	/* external IRQ3 */
#define CDB4_COM_IRQPRI		5	/* interrupt priority */
#define CDB4_COM_RESET_BIT	13	/* PA13 hooked to 16C554 RESET line */
#define STD_COM_FLAGS		ASYNC_BOOT_AUTOCONF

#define SERIAL_PORT_DFNS					\
	{										\
		.baud_base	= BASE_BAUD,			\
		.iomem_base	= CDB4_COM_BASE + 0x10,	\
		.io_type	= SERIAL_IO_MEM,		\
		.irq		= CDB4_COM_IRQ,			\
		.flags		= STD_COM_FLAGS			\
	},										\
	{										\
		.baud_base	= BASE_BAUD,			\
		.iomem_base	= CDB4_COM_BASE + 0x18,	\
		.io_type	= SERIAL_IO_MEM,		\
		.irq		= CDB4_COM_IRQ,			\
		.flags		= STD_COM_FLAGS			\
	},										\
	{										\
		.baud_base	= BASE_BAUD,			\
		.iomem_base	= CDB4_COM_BASE + 0x20,	\
		.io_type	= SERIAL_IO_MEM,		\
		.irq		= CDB4_COM_IRQ,			\
		.flags		= STD_COM_FLAGS			\
	},										\
	{										\
		.baud_base	= BASE_BAUD,			\
		.iomem_base	= CDB4_COM_BASE + 0x28,	\
		.io_type	= SERIAL_IO_MEM,		\
		.irq		= CDB4_COM_IRQ,			\
		.flags		= STD_COM_FLAGS			\
	}

#define RS_TABLE_SIZE  4

#else /* !CONFIG_SERIAL_CDB4 */

#error serial port not supported on this board

#endif /* !CONFIG_SERIAL_CDB4 */

#endif /* _CKCORE_SERIAL_H */

